using Basket.Api;
using BuildingBlocks.Presentation.Endpoints;
using ServiceDefaults;

var builder = WebApplication.CreateBuilder(args);

builder.AddServiceDefaults();

builder.Services.AddBasketPresentation()
    .AddBasketApplication()
    .AddBasketInfrastructure(builder.Configuration);

builder.Services.AddEndpoints(typeof(DependencyInjection).Assembly);
var app = builder.Build();

app.MapDefaultEndpoints();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseRouting();
app.UseHttpsRedirection();
app.UseCors("SpaCors");
app.UseAuthentication();
app.UseAuthorization();
app.MapEndpoints();
app.Run();
